{include file='fcworker/fc_userdata_head'}


<div id="mescroll" class="mescroll">

    <div id="app">
        {include file='fcworker/fc_userdata_head_user'}
        <div class="journalList">
            <ul id="newsList"  class="news-list">
            </ul>
        </div>
    </div>
    <input type="hidden" name="page" id="page" value="0">
    <input type="hidden" name="op" id="op" value="user_log_list">
    <input type="hidden" name="uid" id="uid" value="{$uid}">
    <input type="hidden" name="type" id="type" value="{$type}">
    <input type="hidden" name="hasNext" id="hasNext" value="{$hasNext}">
    <div style="height: 1.1rem;"></div>
</div>
</div>
 </body>
<!--  下拉刷新-->
 <script type="text/javascript" charset="utf-8">
     const mescroll = new MeScroll("mescroll", {
         down: {
             auto: false,
             callback: () => {
                 mescroll.endSuccess();
                 setTimeout(() => {
                     window.location.reload();
                 },500)
             }
         },
         up: {
             use: false
         }
     })
	 $(function(){
		 getData(1)
	 });
	 var loadingState= true;
	 var hasNext = 1;
	 $('#mescroll').scroll(function(){
		 hasNext = $("#hasNext").val();
		 var height = $('#app').height();
		 var scrollSpace = $(this).scrollTop();
		 if(scrollSpace>height){
			 $('.backTop').fadeIn();
		 }else{
			 $('.backTop').fadeOut();
		 }
		 if (Math.ceil(scrollSpace) + $(window).height() >= height){
			 if (!loadingState && hasNext==1){
				 loadingState = true;
				 layer.msg('加载中', {
					 icon: 16
					 ,shade: 0.01
				 });
				 getData(hasNext)
			 }
		 }
	 })

	 function  getData(hasNext){
		 var page = $("#page").val();
		 var uid = $("#uid").val();
		 var op = $("#op").val();
         var type = $("#type").val();
		 var next_page = +page+1;
		 var postUrl="/{php echo  createMobileUrl('main',array('themeid'=>$themeid,'mod'=> 'userdata'));}";
		 $.ajax({
			 url:postUrl,
			 dataType:'json',
			 method:'post',
			 data: {type:type,op:op,page:next_page,uid:uid},
			 success:function (e) {
				 let data = e.data.res_list;
				 let error = e.error;
				 let msg = e.msg;
				 if (error!=0){
					 layer.msg(msg);
				 }else{
					 var curPageData = data.curPageData;
					 var hasNext = data.hasNext;
					 setListData(curPageData, true,false);
					 layer.closeAll();
				 }
				 loadingState = false;
				 if (data.hasNext){
					 hasNext = 1;
				 }else{
					 hasNext = 0;
				 }
				 $("#hasNext").val(hasNext);
				 $("#page").val(next_page);
			 },
			 fail:function (err) {
				 console.log(err)
			 }
		 });
	 }
 </script>
{include file='fcworker/fc_userdata_setList'}

{if $system['h5work'] == '1'}
{include file='fcworker/fc_foot'}
{else}
{include file='yxworker/w_head'}
{/if}

